<?php get_instance()->view('common/header');?>
<body class="bag3">
<form action="<?php echo getUrl('pay/deposit')?>" id="save-form" method="post">
    <div class="kainfo">
        <a href="<?php echo getUrl('money/bank?type=1')?>" class="heng bor_bb p10_0">
            <p class="f09 cor6">到账银行卡</p>
            <p class="huangzi f09">
                <?php if (empty($cardInfo)):?> 请选择到账银行
                <?php else:?> <?php echo $cardInfo['open_bank'].'('.substr($cardInfo['account_number'], -4).')'?> <?php endif;?>
                <input type="hidden" value="<?php echo empty($cardInfo) ? 0 : $cardInfo['id']?>" name="bank_id">
            </p>
        </a>
        <div class="bor_bb">
            <div class="heng p10_0">
                <p class="f09 cor6">提现金额</p>
            </div>
            <div class="hengleft">
                <p class="f12 mtmin">¥</p><input type="text" value="" class="weui-input f20 plmin" name="amount">
            </div>
        </div>
        <div class="heng p10_0">
            <p class="f09 cor6">钱包余额¥<?php echo $this->userBalance?></p>
            <p class="cor8 f09">1～3个工作日到账<a href="javascript:;" class="huangzi ml5 getAll">全部提现</a></p>
        </div>
        <input type="hidden" name="pay_passwd" value="">
        <div class="p10_0">
            <a class="kbtn" id="showIOSDialog1">提现</a>
        </div>
    </div>
</form>
<?php get_instance()->view('common/dialog');?>
</body>
<script src="<?php echo $this->staticUrl?>js/jquery-validate.js" type="text/javascript"></script>
<script src="<?php echo $this->staticUrl?>js/validate.js" type="text/javascript"></script>
<script src="<?php echo $this->staticUrl?>js/base.js"></script>
<script>
    var $iosDialog1 = $("#iosDialog1"),
        payPassword = $("#payPassword_container"),
        _this = payPassword.find('i');
    $('#showIOSDialog1').on('click', function(){
        var amount = $("[name='amount']").val();
        var bank_id = $("[name='bank_id']").val();
        if (!amount.length){
            show_message({status:0, message:'请输入提现金额'});
            return;
        }
        if (bank_id == 0){
            show_message({status:0, message:'请选择到账银行卡'});
            return;
        }
        $iosDialog1.fadeIn(200);

        _this.eq(0).addClass("active");
        $('#cardwrap').css({'visibility':'hidden',"left":"0"});
        _this.removeClass("active");
        _this.eq(0).addClass("active");
        _this.find("b").css('visibility','hidden');
        $("#payPassword_container").find("i").removeClass("active");
        $("#payPassword_rsainput").val('');
        $("#payPassword_rsainput").focus();
    });

    /**
     * 取消
     */
    $iosDialog1.find(".weui-dialog__btn_default").on('click', function () {
        $(this).parents('.js_dialog').fadeOut(200);
    });

    /**
     * 确定
     */
    $iosDialog1.find(".weui-dialog__btn_primary").on('click', function () {
        var vl = $("#payPassword_rsainput").val();
        $("[name='pay_passwd']").val(vl);
        $("#save-form").submit();
        $(this).parents('.js_dialog').fadeOut(200);
    });

    $(function () {
        $.e_validate.init('#save-form',{saveMessage:'保存中...'});

        /**
         * 全部提现
         */
        $(".getAll").click(function () {
            var vl = "<?php echo $this->userBalance?>";
            $("[name='amount']").val(vl);
        });
    })

</script>
</html>